home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / dbms_mag / 9104 / olympia1.apr < prev    next >
Text File  |  1991-02-13  |  3KB  |  87 lines

  1.  
  2. PROCEDURE MkccMail
  3. ************************************************************
  4. * Program ...: MkccMail.prg
  5. *            :
  6. * Author ....: P. L. Olympia, Platinum Software Int'l, 11/90
  7. *            :
  8. * Language...: FoxPro. Uses low-level file I/O functions.
  9. *            :
  10. * Purpose....: Creates a file that can be IMPORTed into
  11. *            : cc:Mail as a message. The message file can
  12. *            : have a binary file attached to it. In this
  13. *            : implementation, the content of the actual
  14. *            : message is read from a text file.
  15. *            :
  16. * Public Vars: To minimize the number of parameters passed
  17. *            : to this procedure, the following public
  18. *            : character memvars should have been assigned
  19. *            : appropriate values before this procedure is
  20. *            : called:
  21. *            :  MsgFrom  = Name of message sender
  22. *            :  PswdFrom = Password of message sender
  23. *            :  CCdata   = Path/directory where cc:Mail DB is
  24. *            :
  25. * Syntax.....: DO MkccMail WITH MsgTo, MsgSubj, MsgImpt,
  26. *            :   MsgTxt, FileApnd
  27. :            :
  28. * Notes .....: This code has minimal error checking
  29. ************************************************************
  30. PARA  MsgTo, MsgSubj, MsgImpt, MsgTxt, FileApnd
  31. *      |       |        |        |      |
  32. *      |       |        |        |   File to append, if any
  33. *      |   Msg Subject  |        |
  34. *      |_Receiver name  |      File containing text of msg
  35. *                       |_ Name of file this pgm creates
  36. *
  37. * Examples:
  38. *   MsgTo    =  "Molly Puffin"
  39. *   MsgSubj  =  "European FoxPro Conference"
  40. *   MsgImpt  =  "A:\ccmail.imp"
  41. *   MsgTxt   =  "D:\ccmail\puffin\foxconf.txt"
  42. *   FileApnd =  "F:\DBASE\SLIDES.ZIP"
  43.  
  44. *-- Comment out these 3 lines if you don't need them
  45. SET TALK OFF
  46. CLOSE ALL
  47. CLEAR ALL
  48.  
  49. fh_out = FCREATE(msgimpt)
  50. IF fh_out < 0
  51.  ? "Cannot create ", msgimpt
  52.  RETU
  53. ENDIF
  54.  
  55. *-- Write message headers/preamble
  56. writeit = FPUTS(fh_out, "Message:")
  57. writeit = FPUTS(fh_out, "From: " + msgfrom)
  58. writeit = FPUTS(fh_out, "Date: " + DTOC(DATE()) + ;
  59.              " " + TIME())
  60. writeit = FPUTS(fh_out, "To: " + msgto)
  61. writeit = FPUTS(fh_out, "Subject: " + msgsubj)
  62. writeit = FPUTS(fh_out, "Contents:")
  63.  
  64. *-- Write the actual message
  65. IF  FILE(msgtxt)
  66.    fh_in1 = FOPEN(msgtxt)
  67.    DO WHILE ! FEOF(fh_in1)
  68.       str = FGETS(fh_in1)
  69.       writeit = FPUTS(fh_out, str)
  70.    ENDD
  71.   =FCLOSE(fh_in1)
  72. ENDIF
  73.  
  74. *-- If there is a file to be appended, append it now
  75. IF  FILE(fileapnd) 
  76.    writeit = FPUTS(fh_out, "File Item: " + fileapnd)
  77. ENDIF
  78.  
  79. =FCLOSE(fh_out)
  80.  
  81. **-- Send the message to cc:Mail
  82. str = msgfrom + SPAC(1) + pswdfrom + SPAC(1) + ccdata + ;
  83.        " @" + msgimpt
  84. ! /100 IMPORT &str
  85.  
  86. RETURN
  87.